import { _decorator, Component, Node,Label,director } from 'cc';
// import * as i18n from 'db://i18n/LanguageData';
const { ccclass, property } = _decorator;

@ccclass('MenuManage')
export class MenuManage extends Component {
    @property({ type: Node })
    ceshiButton: Node | null = null;
    @property({ type: Label })
    ceShiLabel: Label | null = null;

    private shuliang: number = 0;

    protected onLoad(): void {
        /////预加载场景
       director.preloadScene('home',function(err,scene){
           console.log('err:',err);
           console.log('scene:',scene);
       });
    }

    start() {
        console.log(this);
    }

    update(deltaTime: number) {
        // console.log('deltaTime:',deltaTime);
        this.shuliang = deltaTime*60+this.shuliang;///帧率补偿
        if(this.ceShiLabel){
            this.ceShiLabel.getComponent(Label).string = 'boonook'+this.shuliang.toString();
        }
    }

    onStartButtonClicked(){
        console.log('onStartButtonClicked:',this.ceShiLabel.getComponent(Label).string);
    }

    onChangJingQieHuan(){
        ////直接跳转场景
       director.loadScene('home',function(err,scene){
           console.log('err:',err);
           console.log('scene:',scene);
       });
    }

    ////语言切换
    changeLang() {
        // if (i18n._language === 'en') {
        //     i18n.init('zh');
        // } else {
        //     i18n.init('en');
        // }
        // i18n.updateSceneRenderers();
    }
}


